import pandas as pd

from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.globals import CurrentConfig

CurrentConfig.ONLINE_HOST = "http://127.0.0.1:8000/assets/"

df = pd.read_excel("./Files/服装销售数据.xlsx")
print(df)

bar = (
    Bar()
    .add_xaxis(df["商品"].to_list())
    .add_yaxis(df["商家A"], df["商家A"].to_list())
    .add_yaxis(df["商家B"], df["商家B"].to_list())
    .set_global_opts(title_opts=opts.TitleOpts(title="商品销售对比图"), legend_opts=opts.LegendOpts(is_show=True)))

# bar.render()
bar.render(path='./Files/my_chart.html')
